Skip to content

Comments

Create Week8 Mission 1, 2#102

Merged
hyeok02 merged 1 commit intomainfrom
ysh2002m
May 27, 2025
Merged

Create Week8 Mission 1, 2#102
hyeok02 merged 1 commit intomainfrom
ysh2002m

Conversation

@hyeok02
Copy link
Collaborator

@hyeok02 hyeok02 commented May 19, 2025

📝 미션 번호

8주차 Misson 1,2

📋 구현 사항

  • Debounce를 활용하여 불필요한 호출 막아보기
  • Throttling을 활용하여 불필요한 호출 막아보기

📎 스크린샷

image image

✅ 체크리스트

  • Merge 하려는 브랜치가 올바르게 설정되어 있나요?
  • 로컬에서 실행했을 때 에러가 발생하지 않나요?
  • 불필요한 주석이 제거되었나요?
  • 코드 스타일이 일관적인가요?

🤔 질문 사항

@hyeok02 hyeok02 changed the title feat: Create Week8 Mission 1, 2 Create Week8 Mission 1, 2 May 20, 2025
Copy link
Member

@hyesngy hyesngy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이번 주 워크북을 통해 React의 성능 최적화 기법인 debouncethrottle을 적용해봤습니다! 쉽지 않은 개념이지만 모두 잘 해내셔서 대단합니다! 👏🏻👏🏻👏🏻

이런 최적화 기법들은 실제 서비스에서 UX를 크게 향상시키는 요소입니다. 앞으로 있을 데모데이 프로젝트에서도 꼭 활용해서 구현해보면 좋겠습니다!👍🏻👍🏻👍🏻

Comment on lines +16 to +25
const searchLpsResult = useInfiniteSearchLps({
searchType: "title",
keyword: debouncedKeyword,
order,
});

const tagLpsResult = useInfiniteTagSearchLps({
tagName: debouncedKeyword,
order,
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 search.tsx에서 useInfiniteSearchLpsuseInfiniteTagSearchLps 두 개의 훅을 사용하고, 각각의 훅에서 거의 동일한 무한 스크롤 로직을 중복 구현하고 있습니다. useInfiniteSearchLps 내부에서 이미 searchType에 따라 다른 API를 호출하는 로직이 있음에도 불구하고, 태그 검색만을 위한 별도 훅을 또 만들어 사용하고 있는데, 이는 코드가 중복되고 유지보수성 측면에서 좋지 않습니다.

코드 일관성을 위해 하나의 훅으로 통합하여 관리하는 것이 좋을 것 같습니다!

Comment on lines +112 to +127
<div className="flex justify-end w-full mb-4 pr-20">
<div className="flex border rounded overflow-hidden">
<button
onClick={() => handleOrderChange("asc")}
className={`w-24 px-4 py-1 text-sm ${order === "asc" ? "bg-black text-white" : "bg-white text-black"}`}
>
오래된순
</button>
<button
onClick={() => handleOrderChange("desc")}
className={`w-24 px-4 py-1 text-sm ${order === "desc" ? "bg-black text-white" : "bg-white text-black"}`}
>
최신순
</button>
</div>
</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 search.tsx와 home.tsx에서 정렬 버튼 UI가 중복되고 있는데, 이 부분을 별도의 SortButton 컴포넌트로 분리하면 코드 중복을 줄이고 일관된 UI를 유지할 수 있을 것 같습니다.

@hyeok02 hyeok02 merged commit 6629393 into main May 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants